package com.spic.business.blast.domain;

import com.alibaba.fastjson.JSON;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * @author 290512
 * @create 2022-03-04 9:50
 */
@Data
public class ChargePositionVo
{
    private String chargeHoleId; //炸药孔位id
    private String longitude; //经度
    private String latitude; //纬度


    public static void main(String[] args)
    {
        List<ChargePositionVo> list = new ArrayList<>();
        for(int i = 1;i<10;i++){
            ChargePositionVo chargePositionVo = new ChargePositionVo();
            chargePositionVo.setChargeHoleId(""+i);
            chargePositionVo.setLongitude("119.99"+i);
            chargePositionVo.setLatitude("450.45"+i);
            list.add(chargePositionVo);
        }
//        JSONArray array= JSONArray.parseArray(JSON.toJSONString(list));
//        List<ChargePositionVo> c = JSONObject.parseArray(array.toJSONString(), ChargePositionVo.class, new ParserConfig());
        String arr = "[{\"latitude\":\"450.458\",\"chargeHoleId\":\"10\",\"longitude\":\"119.998\"},{\"latitude\":\"450.458\",\"chargeHoleId\":\"8\",\"longitude\":\"119.998\"},{\"latitude\":\"450.459\",\"chargeHoleId\":\"9\",\"longitude\":\"119.999\"}]";
        String b = "{\"latitude\":\"450.458\",\"chargeHoleId\":\"10\",\"longitude\":\"119.998\"}";

        List<ChargePositionVo> cList = JSON.parseArray(arr, ChargePositionVo.class);
//        ChargePositionVo chargePositionVo = JSON.parseObject(b, ChargePositionVo.class);
//        cList.add(chargePositionVo);
//        String s = JSONArray.parseArray(JSON.toJSONString(cList)).toString();
//        System.out.println(s);

//        ChargePositionVo chargePositionVo = JSON.parseObject(b, ChargePositionVo.class);
//        String s = JSON.toJSONString(chargePositionVo);
//        String news = "["+s+"]";
//        System.out.println(news);


//        String holeId = "8";
//
//        List<ChargePositionVo> collect = cList.stream().filter(v -> !v.getChargeHoleId().equals(holeId)).collect(Collectors.toList());
//        System.out.println(collect);


        String localCode="BP2022030401";
        String pDate = localCode.substring(2,10);
        String pNumber = localCode.substring(localCode.length()-2);
        System.out.println(pDate+"--------------------"+pNumber);
    }
}
